<script type="text/javascript">
	$(document).ready(function(){
		$.validator.messages.required = "";
		$.validator.messages.date = "";
		$.validator.messages.email = "";
		$.validator.messages.number = "";
		$("#VanBanDi").validate();
	});
</script>
<?php
if(isset($_SESSION['QuyenHan']))
{
?>

<div id="NoiDung" class="form">
  <h3 class="text-primary">Văn Bản Đi</h3>
  <form  action="vanbandi-them-xuly" method="post" role="form" id="VanBanDi" enctype="multipart/form-data">
    <input type="hidden" name="MaNguoiDangKy" value="<?php echo $_SESSION['MaNguoiDung']?>"/>
    <table class="table borderless">
      <tbody>
        <tr>
          <td><div class="form-group form-custom">
              <label  for="sovakyhieu">Số và ký hiệu:</label>
              <input type="text" class="form-control" placeholder="Số và ký hiệu" name="SovaKyHieu" class="required" />
            </div></td>
          <td><div class="form-group form-custom">
              <label  for="noibanhanh">Nơi ban hành:</label>
              <input type="text" class="form-control" placeholder="Nơi ban hành" name="NoiBanHanh" class="required" />
            </div></td>
        </tr>
        <tr>
          <td><div class=" form-group form-custom control-group">
              <label class="control-label">Ngày ban hành</label>
              <div class="controls input-append date form_date" data-date="" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                <input size="16" type="text" value="" readonly="readonly" name="NgayBanHanh" class="form-control">
                <span class="add-on"><i class="icon-remove"></i></span> <span class="add-on"><i class="icon-th"></i></span> </div>
            </div></td>
          <td><div class=" form-group form-custom control-group">
              <label class="control-label">Ngày hết hạn</label>
              <div class="controls input-append date form_date" data-date="" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                <input size="16" type="text" value="" readonly="readonly" name="NgayHetHan" class="form-control">
                <span class="add-on"><i class="icon-remove"></i></span> <span class="add-on"><i class="icon-th"></i></span> </div>
            </div></td>
        </tr>
        <tr>
          <td><div class="form-group form-custom">
              <label  for="maloaivanban">Loại Văn Bản:</label>
              <select name="MaLoaiVanBan" class="form-control">
                <?php
                    $loaiVB = new loaivanbanbs();
                    $dsLVB = $loaiVB->GetList();
                    for($i=0;$i< count($dsLVB) ;$i++)
                    {
                        echo "<option value=".$dsLVB[$i]['MaLoaiVanBan'].">".$dsLVB[$i]['TenLoaiVanBan']."</option>";
                    }
                   ?>
              </select>
            </div></td>
          <td><div class="form-group form-custom">
              <label  for="trichyeu">Trích Yếu:</label>
              <input type="text" class="form-control" placeholder="Trích yếu" name="TrichYeu" class="required" />
            </div></td>
        </tr>
        <tr>
          <td><div class="form-group form-custom">
              <input type="radio" name="NoiGoi" value="0">
              <label  for="BenNgoai">Đơn vị ngoài:</label>
              <input type="text" class="form-control" placeholder="Nơi ban hành" name="DonViNgoai" class="required" />
            </div></td>
          <td><div class="form-group form-custom">
              <input type="radio" name="NoiGoi" value="1">
              <label  for="PhongBan">Phòng ban:</label>
              <select class="form-control" name="MaPhongBan">
                <?php
                            $phongban = new phongbanbs();
                            $dsphongban = $phongban->GetList();
                            for($i=0;$i<count($dsphongban);$i++)
                            {
                                echo "<option value=".$dsphongban[$i]['MaPhongBan'].">".$dsphongban[$i]['TenPhongBan']."</option>";
                            }
                        ?>
              </select>
            </div></td>
        </tr>
        <tr>
          <td colspan="2" ><div class="form-group form-custom">
              <input type="radio" name="NoiGoi" value="2">
              <label  for="NguoiNhan">Người nhận:</label>
              <select class="form-control" name="MaNguoiDung" >
                <?php
                            $nguoidung = new nguoidungbs();
                            $dsnguoidung = $nguoidung->GetList();
                            for($i=0;$i<count($dsnguoidung);$i++)
                            {
                                echo "<option value=".$dsnguoidung[$i]['MaNguoiDung'].">".$dsnguoidung[$i]['TenNguoiDung']."-".$dsnguoidung[$i]['TenChucVu']."-".$dsnguoidung[$i]['TenPhongBan']."</option>";
                            }
                        ?>
              </select>
            </div></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2"><div class="form-group form-custom">
              <label>Đính kèm</label>
              <input id="file-3" type="file" name="file[]" multiple=true>
            </div></td>
        </tr>
        <tr>
          <td colspan="2"><input type="submit" value="Thêm" class="btn btn-primary btn-primary pull-right" name="btnThem" /></td>
        </tr>
      </tbody>
    </table>
  </form>
</div>
<script>   
    
	$("#file-3").fileinput({
		showUpload: false,
		showCaption: false,
		browseClass: "btn btn-primary",
		fileType: "any",
        previewFileIcon: "<i class='glyphicon glyphicon-king'></i>"
	});

</script> 
<script type="text/javascript">
   
	$('.form_date').datetimepicker({
      	format: 'dd-mm-yyyy',
        weekStart: 1,
        todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		minView: 2,
		forceParse: 0
    });
	
</script>
<?php
}else
{
	ThongBaoLoi("Vui lòng đăng nhập !");
}

?>
